export class BevelGearParams{
  constructor(z = 17, m = 8, alpha = 20, faceWidth = 40, helixDirection = 'leftHelix',
              helixAngle = 15, coneAngle = 45, addendumModiCoef = 0.0, tangentialModiCoef = 0.0,
              addendumCoefficient = 1.0,  clearanceCoefficient = 0.2) {
    /**
     * 齿数 z （5≤z≤200）
     */
    this.teethNumber = z;

    /**
     * 模数 m
     */
    this.outerModule = m;

    /**
     * 压力角 α（10deg≤α≤20deg），此处转换为弧度值
     */
    this.alpha = alpha / 180 * Math.PI;

    /**
     * 齿距 p = m * π
     * 齿厚：齿轮齿面厚度
     */
    this.teethPitch = m * Math.PI;

    /**
     * 齿宽，即柱齿轮拉伸长度
     */
    this.teethWidth = faceWidth;

    /**
     * 齿根圆角半径 rr = 0.2 * m
     */
    this.teethFilterR = 0.2 * m;

    /**
     * 齿顶高系数 ha*
     * ha* = ha / m
     * 正常齿：1
     * 短齿：0.8
     * ha: 齿顶高，分度圆到齿顶圆之间的径向距离
     */
    this.addendumCoefficient = 1;
    this.ha = this.addendumCoefficient * m;

    /**
     * 齿根高系数 hf*
     * hf* = hf / m
     * hf* = 1.25,当 m>1.25时
     * hf* =1.4,当 m≤1.25 时
     * hf 齿根高，分度圆到齿根圆之间的径向距离
     */
    if (m > 1.25) {
      this.dedendumCoefficient = 1.25;
    } else {
      this.dedendumCoefficient = 1.4;
    }
    this.hf = this.dedendumCoefficient * m;

    /**
     * 分度圆半径 rp = m * z / 2
     * 分度圆直径 dp
     */
    this.rp = this.module * this.teethNumber / 2;
    this.dividingD = this.rp * 2;

    /**
     * 基元半径 rb = rp * cos(α)， 此处α为弧度值
     * 基圆直径 db
     */
    this.rb = this.rp * Math.cos(this.alpha);
    this.baseD = this.rb * 2;

    /**
     * 齿顶圆半径 ra = rp + ha
     * 齿顶圆直径 da
     */
    this.ra = this.rp + this.ha;
    this.addendumD = this.ra * 2;

    /**
     * 齿根圆半径 rf = rp - hf
     * 齿根圆直径 df
     */
    this.rf = this.rp - this.hf;
    this.dedendumD = this.rf * 2;

    /**
     * 柱斜齿轮螺旋方向，左旋：1；右旋：2
     */
    if (helixDirection === 'leftHelix') {
      this.helixDirection = 1;
    } else if (helixDirection === 'rightHelix') {
      this.helixDirection = 2;
    }

    /**
     * 柱斜齿轮的分度圆螺旋角 b，此处转换为弧度值
     */
    this.helixAngle = helixAngle  / 180 * Math.PI;
  }
}
